// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

/** 获取规则列表 GET /api/rule */
export async function getBannerPage(
  data: {
    // query
    /** 当前的页码 */
    page?: number;
    /** 页面的容量 */
    size?: number;
  },
  options?: { [key: string]: any },
) {
  return request<{
    code?: number;
    msg?: string;
    data?: Record<string, any>;
  }>('/extra-server/api/v1/banner/page', {
    method: 'post',
    data,
    ...(options || {}),
  });
}

/** 新建规则 PUT /api/rule */
export async function updateBanner(data: { [key: string]: any }, options?: { [key: string]: any }) {
  return request<{
    code?: number;
    msg?: string;
    data?: Record<string, any>;
  }>('/extra-server/api/v1/banner/update', {
    data,
    method: 'put',
    ...(options || {}),
  });
}

/** 新建规则 POST /api/rule */
export async function addBanner(data: { [key: string]: any }, options?: { [key: string]: any }) {
  return request<{
    code?: number;
    msg?: string;
    data?: Record<string, any>;
  }>('/extra-server/api/v1/banner/save', {
    data,
    method: 'POST',
    ...(options || {}),
  });
}

/** 删除规则 DELETE /api/rule */
export async function batchDelBanner(data: { idList: number[] }, options?: { [key: string]: any }) {
  return request<{
    code?: number;
    msg?: string;
    data?: Record<string, any>;
  }>('/extra-server/api/v1/banner/batch_del', {
    data,
    method: 'delete',
    ...(options || {}),
  });
}
